package com.example.zheng.qq.controller;

import android.os.AsyncTask;
import android.view.WindowManager;
import android.widget.LinearLayout;



/**
 * Created by zheng on 17-4-25.
 * 异步加载进度
 */
public class ProgressTask extends AsyncTask<Integer,Integer,Boolean>{

    private LinearLayout mLinear;
    private WindowManager mWindow;
    public ProgressTask(LinearLayout mLinear,WindowManager mWindow){
        super();
        this.mLinear=mLinear;
        this.mWindow=mWindow;
    }
    @Override
    protected Boolean doInBackground(Integer... params) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        publishProgress(100);
        return true;
    }

    @Override
    protected void onPostExecute(Boolean aBoolean) {
        cancel(true);
         if(mLinear!=null){
             mWindow.removeView(mLinear);
             mLinear=null;
         }

    }





}
